package ltd.dujiabao.activemq.spring.bean;

import org.springframework.stereotype.Component;

import javax.jms.*;

/**
 * @author : DuJiabao
 * @Project : active-mq
 * @Time : 2021/5/6 11:22
 * @Desc :
 */
@Component
public class MyMessageListener implements MessageListener {
  @Override
  public void onMessage(Message message) {
    if (message instanceof TextMessage) {
      TextMessage textMessage = (TextMessage) message;
      try {
        System.out.println("收到了一条TextMessage" + textMessage.getText());
      } catch (JMSException e) {
        e.printStackTrace();
      }
    }
  }
}
